package baptizeattribute.inventory;

import baptizeattribute.data.Data;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class Inv {
    public static int itemOneID = 10;
    public static int itemGoID = 13;
    public static int itemTwoID = 16;
    public static String ivName = Data.config.getInvTitle();
    public static Map<UUID,Inventory> playerIv;

    public static void OpenGui(Player p){
        Inventory iv = Bukkit.createInventory(null, 27, ivName);
        ItemStack is = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)3);
        for (int i = 0; i < iv.getSize(); i++) {
            if (i==itemOneID || i==itemTwoID){
                continue;
            }
            if (i == itemGoID){
                ItemStack isGo = new ItemStack(426);
                ItemMeta itemMeta = isGo.getItemMeta();
                List<String> list = new ArrayList<>();
                list.add("");
                list.add("§a<---§d装备       §d材料§a--->");
                list.add("");
                list.add("§a点击洗炼...");
                itemMeta.setLore(list);
                itemMeta.setDisplayName("§e洗炼装备");
                isGo.setItemMeta(itemMeta);
                iv.setItem(i,isGo);
                continue;
            }
            iv.setItem(i,is);
        }
        playerIv.put(p.getUniqueId(),iv);
        p.openInventory(playerIv.get(p.getUniqueId()));
        Data.guiFlag.put(p.getUniqueId(),true);
    }
}
